package oo

import "fmt"

func structInit() {
	//一般方式
	var p1 Person
	p1.name = "Lily"
	p1.city = "Shanghai"
	p1.age = 24
	fmt.Printf("%#v\n", p1)

	//new函数方式，返回指针
	var p2 = new(Person)
	p2.name = "测试"
	p2.age = 18
	p2.city = "北京"
	fmt.Printf("p2=%#v\n", p2)

	//键值对方式
	p3 := Person{
		name: "pprof.cn",
		city: "北京",
		age:  18,
	}
	fmt.Printf("p5=%#v\n", p3)

	//构造函数方式
	p := NewPerson("mike", "wuhan", 23)
	fmt.Printf("%#v\n", p)

}

func RunOO() {

	//structInit()
	//testType()
	//testTypeAssert()
	//justifyType(8)
	u := nestStruct()
	fmt.Println(u.Name)
}
